package com.etone.web.controller.system;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.etone.common.annotation.Log;
import com.etone.common.core.controller.BaseController;
import com.etone.common.core.domain.AjaxResult;
import com.etone.common.enums.BusinessType;
import com.etone.system.domain.SysLie;
import com.etone.system.service.ISysLieService;
import com.etone.common.utils.poi.ExcelUtil;
import com.etone.common.core.page.TableDataInfo;

/**
 * 货架列Controller
 * 
 * @author etone
 * @date 2025-05-27
 */
@RestController
@RequestMapping("/system/lie")
public class SysLieController extends BaseController
{
    @Autowired
    private ISysLieService sysLieService;

    /**
     * 查询货架列列表
     */
    @PreAuthorize("@ss.hasPermi('system:lie:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysLie sysLie)
    {
        startPage();
        List<Map<String,Object>> list = sysLieService.selectSysLieList(sysLie);
        return getDataTable(list);
    }

    @RequestMapping("/getLieList")
    public AjaxResult getLieList(){
        return AjaxResult.success(sysLieService.getLieList());
    }

    /**
     * 获取货架列详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:lie:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysLieService.selectSysLieById(id));
    }

    /**
     * 新增货架列
     */
    @PreAuthorize("@ss.hasPermi('system:lie:add')")
    @Log(title = "货架列", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysLie sysLie)
    {
        return toAjax(sysLieService.insertSysLie(sysLie));
    }

    /**
     * 修改货架列
     */
    @PreAuthorize("@ss.hasPermi('system:lie:edit')")
    @Log(title = "货架列", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysLie sysLie)
    {
        return toAjax(sysLieService.updateSysLie(sysLie));
    }

    /**
     * 删除货架列
     */
    @PreAuthorize("@ss.hasPermi('system:lie:remove')")
    @Log(title = "货架列", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysLieService.deleteSysLieByIds(ids));
    }
}
